In the expression -12 + 2 + 4
the "-" means "negative" and is
firmly attached to the 12:
-12 + 2 + 4 = (-12) + 2 + 4 = (-10) + 4 = -6 --- --------- ---------
Once the negative is attached to the 12, the rest is done by going left to right since the two + are of equal priority.
operator |
meaning | priority |
---|---|---|
^ |
power | 1 |
- |
negation | 2 |
* |
multiply | 3 |
/ |
divide | 3 |
+ |
addition | 4 |
- |
subtraction | 4 |
In the priority chart, exponent is the highest priority of all. This means that it will be done before anything else. Remember that "^" means "raised to the power of".
What operator will be done first in the following?
10 * 3 ^ 2 - 5